package online.hxstart.code.concurrent.chapter01;

/**
 * @author huxing
 * @date 19-4-22 星期一 下午3:25
 * @describe 模版设计模式
 */
public class TemplateMethod {
  public static void main(String[] args) {
    //

    TemplateMethod t1 =
        new TemplateMethod() {
          @Override
          protected void wrapPrint(String message) {
            System.out.println("***" + message + "***");
          }
        };
    TemplateMethod t2 =
        new TemplateMethod() {
          @Override
          protected void wrapPrint(String message) {
            System.out.println("***" + message + "***");
          }
        };
    t1.print("t1");
    t2.print("t2");
  }

  protected void wrapPrint(String message) {}

  private final void print(String message) {
    System.out.println("###################");
    wrapPrint(message);
    System.out.println("##############");
  }
}
